{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2023-12-04T01:37:43.870207800Z",
     "start_time": "2023-12-04T01:37:43.833133800Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "\n",
    "df = pd.read_csv('../static/data/car_info.csv')\n",
    "df = df[['brand_name','outter_name','dcar_score','car_name','year','official_price','dealer_price.1']]\n",
    "df['dealer_price'] = df['dealer_price.1']\n",
    "df.drop('dealer_price.1',axis=1,inplace=True)\n",
    "df = df[df['official_price'] != '暂无报价']\n",
    "df['official_price'] = df['official_price'].apply(lambda x:x.replace('万','')).astype(float)\n",
    "df['dealer_price'] = df['dealer_price'].apply(lambda x:x.replace('万','')).astype(float)\n",
    "df.to_csv('../static/data/car_info_pre.csv',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [
    {
     "data": {
      "text/plain": "'\\\\ue420'"
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r'\\u' + hex(58400)[2:]"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-08T13:30:08.140028400Z",
     "start_time": "2023-12-08T13:30:08.127331700Z"
    }
   },
   "id": "2196f4b6e351f9c8"
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [
    {
     "data": {
      "text/plain": "'13.98-22.58'"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "num_code = {\n",
    "        r'\\u' + hex(58400)[2:]: '0',\n",
    "        r'\\u' + hex(58381)[2:]: '1',\n",
    "        r'\\u' + hex(58403)[2:]: '2',\n",
    "        r'\\u' + hex(58377)[2:]: '3',\n",
    "        r'\\u' + hex(58397)[2:]: '4',\n",
    "        r'\\u' + hex(58407)[2:]: '5',\n",
    "        r'\\u' + hex(58393)[2:]: '6',\n",
    "        r'\\u' + hex(58365)[2:]: '7',\n",
    "        r'\\u' + hex(58408)[2:]: '8',\n",
    "        r'\\u' + hex(58387)[2:]: '9'\n",
    "}\n",
    "new_num = '.-.'.encode('unicode_escape').decode('utf-8')\n",
    "for j in num_code:\n",
    "    new_num = new_num.replace(j, num_code[j])\n",
    "new_num"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-08T13:38:15.046520800Z",
     "start_time": "2023-12-08T13:38:15.040522900Z"
    }
   },
   "id": "ee0d75473409c85a"
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [
    {
     "data": {
      "text/plain": "'\\\\ue40d\\\\ue409.\\\\ue413\\\\ue428-\\\\ue423\\\\ue423.\\\\ue427\\\\ue428'"
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'.-.'.encode('unicode_escape').decode('utf-8')"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2023-12-08T13:39:09.902213600Z",
     "start_time": "2023-12-08T13:39:09.898180400Z"
    }
   },
   "id": "63d67e7f899a3944"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
